
import os
out = open('test_role.dy', 'w')
out2 = open('test.dy','w')
for filename in os.listdir('dy'):
    data = open('dy\\' + filename).readlines()
    for d in data:
        d = d.strip()
        #print d.split(' ')[0], d.split(' ')[3]
        out.write(d.split(' ')[3] + '\t' + d.split(' ')[0].split('.')[0] + '\n')
        out2.write(d.split(' ')[3].strip() + '\n')
out.close()
out2.close()
    
